<html>
<head><meta charset="utf-8"><title>bootstrap on linux w/ support for cross-compiling to wind... · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html">bootstrap on linux w/ support for cross-compiling to wind...</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="205913591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205913591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205913591">(Aug 04 2020 at 14:29)</a>:</h4>
<p>do you know off hand, if I attempt to make a local rust build with support for that target, is that going to work on Linux as well?</p>



<a name="205913656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205913656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205913656">(Aug 04 2020 at 14:29)</a>:</h4>
<p>i.e. is it just a matter of adding the appropriate target to a line in my <code>config.toml</code> for Rust?</p>



<a name="205913704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205913704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205913704">(Aug 04 2020 at 14:30)</a>:</h4>
<p>uuh, that's... a good question</p>



<a name="205913733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205913733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205913733">(Aug 04 2020 at 14:30)</a>:</h4>
<p>haven't had to do that yet</p>



<a name="205913824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205913824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205913824">(Aug 04 2020 at 14:31)</a>:</h4>
<p>but do you need to build a compiler? I thought at this point generating LLVM IR and using the LLVM tools to further reduce might be sufficient</p>



<a name="205913912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205913912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205913912">(Aug 04 2020 at 14:31)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> <a href="#narrow/stream/131828-t-compiler/topic/channel.20bug.3A.20.22Instruction.20does.20not.20dominate.20all.20uses.22.20.2372470/near/205913591">said</a>:</p>
<blockquote>
<p>do you know off hand, if I attempt to make a local rust build with support for that target, is that going to work on Linux as well?</p>
</blockquote>
<p>Maybe it would work when building Rlibs only, you cannot build DLLs without the linker and libs.</p>



<a name="205913982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205913982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205913982">(Aug 04 2020 at 14:32)</a>:</h4>
<p>yes, I just was going to try to get the "right" LLVM by building the compiler itself</p>



<a name="205914089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205914089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205914089">(Aug 04 2020 at 14:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> <a href="#narrow/stream/131828-t-compiler/topic/channel.20bug.3A.20.22Instruction.20does.20not.20dominate.20all.20uses.22.20.2372470/near/205913656">said</a>:</p>
<blockquote>
<p>i.e. is it just a matter of adding the appropriate target to a line in my <code>config.toml</code> for Rust?</p>
</blockquote>
<p>This did not work out of the box:</p>
<div class="codehilite"><pre><span></span><code>thread &#39;main&#39; panicked at &#39;
cmake does not support Visual Studio generators.

This is likely due to it being an msys/cygwin build of cmake,
rather than the required windows version, built using MinGW
or Visual Studio.

If you are building under msys2 try installing the mingw-w64-x86_64-cmake
package instead of cmake:
</code></pre></div>



<a name="205914150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205914150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205914150">(Aug 04 2020 at 14:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> <a href="#narrow/stream/131828-t-compiler/topic/channel.20bug.3A.20.22Instruction.20does.20not.20dominate.20all.20uses.22.20.2372470/near/205913982">said</a>:</p>
<blockquote>
<p>yes, I just was going to try to get the "right" LLVM by building the compiler itself</p>
</blockquote>
<p>(and also, I figured it would be useful in the future, when I might want to make local compiler hacks and then test them against this same cross-compiling scenario)</p>



<a name="205914199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205914199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205914199">(Aug 04 2020 at 14:33)</a>:</h4>
<p>There is no "right" LLVM. LLVM is cross compiler so as long as you don't link the binaries it doesn't matter whether you target MSVC from Linux or Windows.</p>



<a name="205914295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205914295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205914295">(Aug 04 2020 at 14:34)</a>:</h4>
<p>well I had figured at the very least I need to ensure I'm using the right version of LLVM</p>



<a name="205914400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205914400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205914400">(Aug 04 2020 at 14:35)</a>:</h4>
<p>but its not a problem; I already got plenty of experience compiling LLVM itself when I was playing around with trying to fix <a href="https://bugs.llvm.org/show_bug.cgi?id=46943">https://bugs.llvm.org/show_bug.cgi?id=46943</a></p>



<a name="205914587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205914587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205914587">(Aug 04 2020 at 14:37)</a>:</h4>
<p>I think we're probably over eager on our sanity checking -- I doubt we actually care about cmake if you're just cross-compiling std</p>



<a name="205914621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205914621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205914621">(Aug 04 2020 at 14:37)</a>:</h4>
<p>it seems likely that you can just comment out <a href="https://github.com/rust-lang/rust/blob/5f6bd6ec0ac422991b89bb8643eaa5d9d46eed11/src/bootstrap/sanity.rs#L221">https://github.com/rust-lang/rust/blob/5f6bd6ec0ac422991b89bb8643eaa5d9d46eed11/src/bootstrap/sanity.rs#L221</a></p>



<a name="205915764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205915764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205915764">(Aug 04 2020 at 14:45)</a>:</h4>
<p>UNIX builds of CMake don't support creating MSVC style projects so this check is correct.</p>



<a name="205915887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205915887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205915887">(Aug 04 2020 at 14:46)</a>:</h4>
<p><span class="user-mention" data-user-id="119581">@mati865</span> my point is that we shouldn't need cmake at all for a cross-compile of std?</p>



<a name="205915889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205915889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205915889">(Aug 04 2020 at 14:46)</a>:</h4>
<p>its a rabbit hole in any case; downgrading that panic to a warning and then rebuilding yields this</p>
<div class="codehilite"><pre><span></span><code> ...
 cargo:warning=cc: error: /Zl: No such file or directory
 ...
</code></pre></div>



<a name="205915926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205915926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205915926">(Aug 04 2020 at 14:46)</a>:</h4>
<p>oh, I guess you need to link std perhaps or something like that? not sure</p>



<a name="205915934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205915934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205915934">(Aug 04 2020 at 14:46)</a>:</h4>
<p>so there's clearly other stuff that we pull in for that target that's going to assume that the host is windows too</p>



<a name="205916227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205916227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205916227">(Aug 04 2020 at 14:49)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/131828-t-compiler/topic/channel.20bug.3A.20.22Instruction.20does.20not.20dominate.20all.20uses.22.20.2372470/near/205915887">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="119581">mati865</span> my point is that we shouldn't need cmake at all for a cross-compile of std?</p>
</blockquote>
<p>True, this shouldn't trigger when building target only MSVC. Probably should be limited to trigger only if LLVM is going to be built.</p>



<a name="205916286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205916286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205916286">(Aug 04 2020 at 14:49)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> <a href="#narrow/stream/131828-t-compiler/topic/channel.20bug.3A.20.22Instruction.20does.20not.20dominate.20all.20uses.22.20.2372470/near/205915889">said</a>:</p>
<blockquote>
<p>its a rabbit hole in any case; downgrading that panic to a warning and then rebuilding yields this</p>
<div class="codehilite"><pre><span></span><code> ...
 cargo:warning=cc: error: /Zl: No such file or directory
 ...
</code></pre></div>


</blockquote>
<p>Maybe you are trying to build dylib std?</p>



<a name="205916395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205916395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205916395">(Aug 04 2020 at 14:50)</a>:</h4>
<p>Seems like that is the default, yes?</p>



<a name="205916417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205916417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205916417">(Aug 04 2020 at 14:50)</a>:</h4>
<p>or wait, I was looking at wrong line in <code>config.toml</code> ...</p>



<a name="205916677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205916677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205916677">(Aug 04 2020 at 14:52)</a>:</h4>
<p>okay, it is the default, so I changed to this:</p>
<div class="codehilite"><pre><span></span><code>crt-static = true
</code></pre></div>


<p>and things seem to progress further</p>



<a name="205916690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205916690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205916690">(Aug 04 2020 at 14:52)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> <a href="#narrow/stream/131828-t-compiler/topic/channel.20bug.3A.20.22Instruction.20does.20not.20dominate.20all.20uses.22.20.2372470/near/205916395">said</a>:</p>
<blockquote>
<p>Seems like that is the default, yes?</p>
</blockquote>
<p>Try changing <code>crate-type = ["dylib", "rlib"]</code> to <code>crate-type = ["rlib"]</code> in all <code>/library</code> crates.</p>



<a name="205916703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205916703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205916703">(Aug 04 2020 at 14:52)</a>:</h4>
<p>but no</p>



<a name="205916732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205916732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205916732">(Aug 04 2020 at 14:52)</a>:</h4>
<p>You cannot produce dylibs unless you have the linker.</p>



<a name="205916739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205916739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205916739">(Aug 04 2020 at 14:52)</a>:</h4>
<p>okay</p>



<a name="205916955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205916955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205916955">(Aug 04 2020 at 14:54)</a>:</h4>
<p>but I also need to not build LLVM, right?</p>



<a name="205917035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205917035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205917035">(Aug 04 2020 at 14:54)</a>:</h4>
<p>(which is probably going to defeat the purpose of this exercise anyway)</p>



<a name="205917488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205917488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205917488">(Aug 04 2020 at 14:58)</a>:</h4>
<p>but, wait, no, I <em>should</em> be able to build LLVM...</p>



<a name="205917532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205917532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205917532">(Aug 04 2020 at 14:58)</a>:</h4>
<p>(the reason why I thought I might not be able to is that I still saw the same <code>/Zl</code> problem while building <code>compiler-rt</code> during bootstrap)</p>



<a name="205917603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205917603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205917603">(Aug 04 2020 at 14:59)</a>:</h4>
<p>maybe I'll just file a bug about this and leave it for later. This does seem like  a use case we should support</p>



<a name="205917668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205917668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205917668">(Aug 04 2020 at 14:59)</a>:</h4>
<p>I'm going to alpha-rename this fork of the original topic (the portion about building locally on linux with windows as one of the targets.)</p>



<a name="205917747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205917747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205917747">(Aug 04 2020 at 15:00)</a>:</h4>
<p>You should be using host LLVM. I thought <code>compiler-rt</code> is build without using CMake.<br>
Anyway I'll be away for 15 min.</p>



<a name="205920947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205920947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205920947">(Aug 04 2020 at 15:22)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119581">mati865</span> <a href="#narrow/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20windows/near/205916227">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/131828-t-compiler/topic/channel.20bug.3A.20.22Instruction.20does.20not.20dominate.20all.20uses.22.20.2372470/near/205915887">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="119581">mati865</span> my point is that we shouldn't need cmake at all for a cross-compile of std?</p>
</blockquote>
<p>True, this shouldn't trigger when building target only MSVC. Probably should be limited to trigger only if LLVM is going to be built.</p>
</blockquote>
<p>Is part of fixing this (in addition to checking if LLVM is going to be built) to also change the condition here: <a href="https://github.com/rust-lang/rust/blob/5f6bd6ec0ac422991b89bb8643eaa5d9d46eed11/src/bootstrap/sanity.rs#L221">https://github.com/rust-lang/rust/blob/5f6bd6ec0ac422991b89bb8643eaa5d9d46eed11/src/bootstrap/sanity.rs#L221</a> to instead say <code>if host.contains("msvc")</code> instead of <code>target</code>?</p>



<a name="205921184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205921184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205921184">(Aug 04 2020 at 15:24)</a>:</h4>
<p>imo the sanity check should just be moved to the llvm step, I think the sanity checks in <a href="http://sanity.rs">sanity.rs</a> should be limited to things we really want to check up front</p>



<a name="205921235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205921235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205921235">(Aug 04 2020 at 15:24)</a>:</h4>
<p>but this seems like something that's best checked right before we build llvm rather than trying to simulate the conditions that cause such a build to happen</p>



<a name="205921263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205921263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205921263">(Aug 04 2020 at 15:24)</a>:</h4>
<p>(e.g., if you provide your own llvm, we shouldn't do this check either probably)</p>



<a name="205921310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205921310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205921310">(Aug 04 2020 at 15:25)</a>:</h4>
<p>I'm still confused by your points above: I had thought that by default we do our own local build of LLVM?</p>



<a name="205921347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205921347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205921347">(Aug 04 2020 at 15:25)</a>:</h4>
<p>is your point that in addition to the other changes, I should also be setting the <code>llvm-config</code> thing in <code>config.toml</code> ?</p>



<a name="205921475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205921475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205921475">(Aug 04 2020 at 15:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="119581">mati865</span> <a href="#narrow/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E/near/205917747">said</a>:</p>
<blockquote>
<p>You should be using host LLVM. I thought <code>compiler-rt</code> is build without using CMake.</p>
</blockquote>
<p>that is, this is the remark I was confused by.</p>



<a name="205921954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205921954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205921954">(Aug 04 2020 at 15:30)</a>:</h4>
<p>By host LLVM I meant LLVM built for the host system, doesn't matter if it's local build or installed from the distro.</p>



<a name="205922011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205922011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205922011">(Aug 04 2020 at 15:30)</a>:</h4>
<p>okay okay, that makes sense then</p>



<a name="205922016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205922016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205922016">(Aug 04 2020 at 15:30)</a>:</h4>
<p>I was under impression you are building LLVM for windows-msvc which is not possible on Linux.</p>



<a name="205922031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205922031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205922031">(Aug 04 2020 at 15:30)</a>:</h4>
<p>yeah, I'm not <em>trying</em> to do that</p>



<a name="205922101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205922101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205922101">(Aug 04 2020 at 15:31)</a>:</h4>
<p>I just am trying to make the most "obvious" changes to <code>config.toml</code> to get support for cross-compiling to windows-msvc in the <code>x.py dist</code> output</p>



<a name="205922147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205922147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205922147">(Aug 04 2020 at 15:32)</a>:</h4>
<p>I have confirmed that <code>compiler-rt</code> is built without CMake via <code>cc-rs</code> crate but I'm not sure if building for msvc will work on Linux.</p>



<a name="205922208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205922208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205922208">(Aug 04 2020 at 15:32)</a>:</h4>
<p>I'll file a bug shortly, this has enough pitfalls that we should probably try to address it, especially if it makes it easier for people to debug problems that only arise when targeting windows-msvc</p>



<a name="205934591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/bootstrap%20on%20linux%20w/%20support%20for%20cross-compiling%20to%20wind.../near/205934591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/bootstrap.20on.20linux.20w.2F.20support.20for.20cross-compiling.20to.20wind.2E.2E.2E.html#205934591">(Aug 04 2020 at 17:22)</a>:</h4>
<p>filed: "support for boostraping on linux with <code>target = ["x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]</code>" <a href="https://github.com/rust-lang/rust/issues/75154">#75154</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>